<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"	
	template="/resources/scaffold/pageTemplate.xhtml">

	<f:metadata>
		<f:viewParam name="id" value="#{stockBean.id}"/>
		<f:event type="preRenderView" listener="#{stockBean.retrieve}"/>
	</f:metadata>

	<ui:param name="pageTitle" value="Create Stock"/>

	<ui:define name="header">
		Stock
	</ui:define>

	<ui:define name="subheader">
		<c:choose>
			<c:when test="#{!empty stockBean.id}">
				Edit existing Stock
			</c:when>
			<c:otherwise>
				Create a new Stock
			</c:otherwise>
		</c:choose>
	</ui:define>

	<ui:define name="footer"/>

	<ui:define name="main">
		<h:form id="create">
			<h:messages globalOnly="true" styleClass="error"/>

			<h:panelGrid columnClasses="label,component,required" columns="3">
				<h:outputLabel for="stockBeanStockUserByModifiedBy" value="User By Modified By:"/>
				<h:panelGroup>
					<h:selectOneMenu converter="#{userBean.converter}" id="stockBeanStockUserByModifiedBy" value="#{stockBean.stock.userByModifiedBy}">
						<f:selectItem/>
						<f:selectItems value="#{userBean.all}"/>
					</h:selectOneMenu>
					<h:message for="stockBeanStockUserByModifiedBy" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockUserByCreatedBy" value="User By Created By:"/>
				<h:panelGroup>
					<h:selectOneMenu converter="#{userBean.converter}" id="stockBeanStockUserByCreatedBy" value="#{stockBean.stock.userByCreatedBy}">
						<f:selectItem/>
						<f:selectItems value="#{userBean.all}"/>
					</h:selectOneMenu>
					<h:message for="stockBeanStockUserByCreatedBy" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockPhoneNo" value="Phone No:"/>
				<h:panelGroup>
					<h:selectOneMenu converter="#{phoneNoBean.converter}" id="stockBeanStockPhoneNo" value="#{stockBean.stock.phoneNo}">
						<f:selectItem/>
						<f:selectItems value="#{phoneNoBean.all}"/>
					</h:selectOneMenu>
					<h:message for="stockBeanStockPhoneNo" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockQuantity" value="Quantity:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockQuantity" value="#{stockBean.stock.quantity}"/>
					<h:message for="stockBeanStockQuantity" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockPricePerUnit" value="Price Per Unit:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockPricePerUnit" value="#{stockBean.stock.pricePerUnit}"/>
					<h:message for="stockBeanStockPricePerUnit" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockPriceTotal" value="Price Total:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockPriceTotal" value="#{stockBean.stock.priceTotal}"/>
					<h:message for="stockBeanStockPriceTotal" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockPurchaseDate" value="Purchase Date:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockPurchaseDate" value="#{stockBean.stock.purchaseDate}"/>
					<h:message for="stockBeanStockPurchaseDate" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockCreatedOn" value="Created On:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockCreatedOn" maxLength="10" value="#{stockBean.stock.createdOn}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="stockBeanStockCreatedOn" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockModifiedOn" value="Modified On:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockModifiedOn" maxLength="10" value="#{stockBean.stock.modifiedOn}">
						<f:convertDateTime type="date"/>
					</h:inputText>
					<h:message for="stockBeanStockModifiedOn" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockTableId" value="Table Id:"/>
				<h:panelGroup>
					<h:inputText id="stockBeanStockTableId" required="true" value="#{stockBean.stock.tableId}"/>
					<h:message for="stockBeanStockTableId" styleClass="error"/>
				</h:panelGroup>
				<h:outputText value="*"/>
				<h:outputLabel for="stockBeanStockIsPublic" value="Is Public:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="stockBeanStockIsPublic" value="#{stockBean.stock.isPublic}"/>
					<h:message for="stockBeanStockIsPublic" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockIsEmpty" value="Is Empty:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="stockBeanStockIsEmpty" value="#{stockBean.stock.isEmpty}"/>
					<h:message for="stockBeanStockIsEmpty" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
				<h:outputLabel for="stockBeanStockIsDeleted" value="Is Deleted:"/>
				<h:panelGroup>
					<h:selectBooleanCheckbox id="stockBeanStockIsDeleted" value="#{stockBean.stock.isDeleted}"/>
					<h:message for="stockBeanStockIsDeleted" styleClass="error"/>
				</h:panelGroup>
				<h:outputText/>
			</h:panelGrid>

			<div class="buttons">
				<h:commandLink value="Save" action="#{stockBean.update}" styleClass="btn btn-primary"/>
				<c:choose>
					<c:when test="#{!empty stockBean.id}">
						<h:link value="Cancel" outcome="view" styleClass="btn btn-primary">
							<f:param name="id" value="#{stockBean.id}"/>
						</h:link>
						<h:commandLink value="Delete" action="#{stockBean.delete}" styleClass="btn btn-primary"/>
					</c:when>
					<c:otherwise>
						<h:link value="Cancel" outcome="search" styleClass="btn btn-primary"/>
					</c:otherwise>
				</c:choose>
			</div>
		</h:form>
	</ui:define>

</ui:composition>